package org.mebusw.struts.davincicode;

import java.io.Serializable;

public class DavinciCard implements Serializable {
	public final static boolean BLACK = true;
	public final static boolean WHITE = false;
	public final static boolean JOKER = true;
	public final static boolean NONJOKER = false;
	public final static int JOKER99 = 99;
	public final static boolean TURNOVER = true;
	public final static boolean STANDING = false;
	public final static int UNKNOWN_CARDID = -1;
	public final static int PLACE_HOLDER = 100;
	public final static int NO_OWNER = -1;

	private boolean isBlack;
	/** 0~11, 99 for joker, -1 for the place holder */
	private int value;
	private boolean isJoker;

	/** used to identify in JSP, 0~25, other for place holder */
	private int cardId;
	/** if it's guessed out, and turn over on the table */
	private boolean isUncover;

	/** which player has this card own */
	private int owner;

	/**
	 * 
	 * @param black Black or White?
	 * @param value Number of Card.
	 * @param joker Is it a joker?
	 * @param cardId Use to trace card uniquely.
	 */
	public DavinciCard(boolean black, int value, boolean joker, int cardId) {
		this.isBlack = black;
		setValue(value);
		this.isJoker = joker;
		this.cardId = cardId;
		this.isUncover = STANDING;
		this.owner = NO_OWNER;
	}

	public int getCardId() {
		return cardId;
	}

	public void setCardId(int cardId) {
		this.cardId = cardId;
	}

	public boolean isBlack() {
		return isBlack;
	}

	public void setBlack(boolean black) {
		this.isBlack = black;
	}

	public int getValue() {
		return value;
	}

	public void setValue(int value) {
		this.value = value;
		if (JOKER99 == value)
			this.isJoker = JOKER;
	}

	public boolean isJoker() {
		return isJoker;
	}

	public void setJoker(boolean joker) {
		this.isJoker = joker;
		if (isJoker)
			this.value = JOKER99;
	}

	public void setOwner(int owner) {
		this.owner = owner;
	}

	public int getOwner() {
		return owner;
	}

	public boolean isUncover() {
		return isUncover;
	}

	public void setUncover(boolean uncover) {
		this.isUncover = uncover;
	}

}
